
function sleep(ms) {
  return new Promise(function (resolve, reject) {
    console.log("走进Promise")
    setTimeout(function () {
      let is = true;
      if(is){
        resolve()
      }else {
        reject()
      }
    },ms)
  })
}
setTimeout(function () {
  console.log("setTimeout")
},500)
sleep(1000).then(function () {
  console.log('执行成功');
}).catch(function () {
  console.log("执行失败");
})
console.log("代码完成")
